﻿using EcoSystem.Office.Enums;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Runtime.Serialization;
using System.Text;

namespace EcoSystem.Office.Excel
{
    /// <summary>
    /// Excel导出选项定义类
    /// </summary>
    public class ExcelImportOptions
    {

        /// <summary>
        /// 要导入的工作表索引
        /// </summary>
        public int SheetIndex { get; set; }

        /// <summary>
        /// 文件格式
        /// </summary>
        public ExcelFileType FileType { get; set; }

        /// <summary>
        /// 是否为模版导入
        /// </summary>
        public bool IsTemplate { get; set; }

        /// <summary>
        /// 导入列映射信息定义
        /// </summary>
        public List<ImportColumn> Columns { get; set; }


        public ExcelImportOptions()
        {
            Columns = new List<ImportColumn>();
        }

        public ExcelImportOptions AddColumn(ImportColumn column)
        {
            this.Columns.Add(column);
            return this;
        }

        public ExcelImportOptions AddColumn(string fieldName, Type dataType, string aliasName = null)
        {
            this.Columns.Add(new ImportColumn()
            {
                AliasName = aliasName,
                DataType = dataType,
                FieldName = fieldName
            });
            return this;
        }
    }

}